/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package co.edu.univalle.modelo;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Jhony
 */
@Entity
@Table(name = "venta_inmueble")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "VentaInmueble.findAll", query = "SELECT v FROM VentaInmueble v"),
    @NamedQuery(name = "VentaInmueble.findByCodVenta", query = "SELECT v FROM VentaInmueble v WHERE v.codVenta = :codVenta"),
    @NamedQuery(name = "VentaInmueble.findByFechaVenta", query = "SELECT v FROM VentaInmueble v WHERE v.fechaVenta = :fechaVenta"),
    @NamedQuery(name = "VentaInmueble.findByValorVenta", query = "SELECT v FROM VentaInmueble v WHERE v.valorVenta = :valorVenta")})
public class VentaInmueble implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "cod_venta")
    private Long codVenta;
    @Column(name = "fecha_venta")
    @Temporal(TemporalType.DATE)
    private Date fechaVenta;
    @Column(name = "valor_venta")
    private Long valorVenta;
    @JoinColumn(name = "cod_inmueble", referencedColumnName = "codigo_inmueble")
    @ManyToOne
    private Inmueble codInmueble;
    @JoinColumn(name = "cedula_comprador", referencedColumnName = "cedula_cliente")
    @ManyToOne
    private Clientes cedulaComprador;

    public VentaInmueble() {
    }

    public VentaInmueble(Long codVenta) {
        this.codVenta = codVenta;
    }

    public Long getCodVenta() {
        return codVenta;
    }

    public void setCodVenta(Long codVenta) {
        this.codVenta = codVenta;
    }

    public Date getFechaVenta() {
        return fechaVenta;
    }

    public void setFechaVenta(Date fechaVenta) {
        this.fechaVenta = fechaVenta;
    }

    public Long getValorVenta() {
        return valorVenta;
    }

    public void setValorVenta(Long valorVenta) {
        this.valorVenta = valorVenta;
    }

    public Inmueble getCodInmueble() {
        return codInmueble;
    }

    public void setCodInmueble(Inmueble codInmueble) {
        this.codInmueble = codInmueble;
    }

    public Clientes getCedulaComprador() {
        return cedulaComprador;
    }

    public void setCedulaComprador(Clientes cedulaComprador) {
        this.cedulaComprador = cedulaComprador;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codVenta != null ? codVenta.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof VentaInmueble)) {
            return false;
        }
        VentaInmueble other = (VentaInmueble) object;
        if ((this.codVenta == null && other.codVenta != null) || (this.codVenta != null && !this.codVenta.equals(other.codVenta))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "co.edu.univalle.modelo.VentaInmueble[ codVenta=" + codVenta + " ]";
    }
    
}
